package com.bigcat.gulimall.demo.java11;

/**
 * @author sufer_yuan
 * @since 2023/4/28
 * <p>
 * string增强
 */
public class StringUp {
    public static void main(String[] args) {
        // 判断字符串是否为空白
        boolean blank = " ".isBlank();// true
        System.out.println("判断字符串是否为空白:" + blank);
        // 去除首尾空格
        String strip = " Javastack ".strip();// "Javastack"
        System.out.println("去除首尾空格:" + strip);
        // 去除尾部空格
        String stripTrailing = " Javastack ".stripTrailing();// " Javastack"
        System.out.println("去除尾部空格:" + stripTrailing);
        // 去除首部空格
        String stripLeading = " Javastack ".stripLeading();// "Javastack "
        System.out.println("去除首部空格:" + stripLeading);
        // 复制字符串
        String repeat = "Java".repeat(3);// "JavaJavaJava"
        System.out.println("复制字符串:" + repeat);
        // 行数统计
        long count = "A\nB\nC".lines().count();// 3
        System.out.println("行数统计：" + count);

        String a = null;

        String b = "1";

        System.out.println(a + "," + b);
    }

}
